<div class="table">
	<h2><?= $stats['name'] ?></h2>
	<div class="content">
		<ul class="row">
			<li class="p_heading">Tier</li>
			<li class="p_stats"><?= $stats['tier'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Rating</li>
			<li class="p_stats"><?= round($stats['rating'], 2) ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Last Played</li>
			<li class="p_stats"><?= $stats['lastplayed'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Kills</li>
			<li class="p_stats"><?= $stats['kills'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Doubles</li>
			<li class="p_stats"><?= $stats['doubles'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Triples</li>
			<li class="p_stats"><?= $stats['triples'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Multiples</li>
			<li class="p_stats"><?= $stats['multi'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Deaths</li>
			<li class="p_stats"><?= $stats['deaths'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Caps</li>
			<li class="p_stats"><?= $stats['caps'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Grabs</li>
			<li class="p_stats"><?= $stats['grabs'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Returns</li>
			<li class="p_stats"><?= $stats['returns'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Kills per Death (K:D)</li>
			<li class="p_stats"><?= $stats['kd'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Caps per Grab (C:G)</li>
			<li class="p_stats"><?= $stats['cg'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Caps per Kill (C:K)</li>
			<li class="p_stats"><?= $stats['ck'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Total Damage Done</li>
			<li class="p_stats"><?= $stats['acc']['damage'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Maps Played</li>
			<li class="p_stats"><?= $stats['maps'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Wins</li>
			<li class="p_stats"><?= $stats['wins'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Win %</li>
			<li class="p_stats">
				<?php if ($stats['maps'] && $stats['wins']):?>
	            	<?= round(($stats['wins']/$stats['maps']), 3) ?>
	            <?php else :?>
	            	0.000
	            <?php endif; ?>
			</li>
		</ul>
		<ul class="row">
			<li class="p_heading">Win/Lose Streak</li>
			<li class="p_stats">
				<?php if ($stats['streak'] != 0): ?>
	            	<?php if ($stats['streak'] > 0): ?>
	            		<?= $stats['streak'] ?> win<?=($stats['streak']>1)?'s':''?>
	            	<?php else : ?>
	            		<?= $stats['streak']*-1 ?> lose<?=($stats['streak']<-1)?'ss':''?>
	            	<?php endif; ?>
	            <?php else : ?>
					N/A
	            <?php endif; ?>
			</li>
		</ul>
		<ul class="row">
			<li class="p_heading">Minutes Played</li>
			<li class="p_stats"><?= $stats['time_played'] ?></li>
		</ul>
		<ul class="row">
			<li class="p_heading">Plus / Minus</li>
			<li class="p_stats">
				<?php if ($stats['plusminus'] > 0): ?>
            		+<?= $stats['plusminus'] ?>
       			<?php else: ?>
            		<?= $stats['plusminus'] ?>
        		<?php endif; ?>
			</li>
		</ul>
	</div>
	<span class="fill"></span>
</div>
<div class="table">
	<h2>Averages</h2>
	<div class="content">
		<ul class="row">
			<li class="p_heading">Caps per Minute</li>
			<li class="p_stats">
				<?php if ($stats['time_played']): ?>
            		<?= round(($stats['caps']/$stats['time_played']), 2) ?>
            	<?php else :?>
            		0
				<?php endif;?>
			</li>
		</ul>
		<ul class="row">
			<li class="p_heading">Kills per Minute</li>
			<li class="p_stats">
				<?php if ($stats['time_played']): ?>
            		<?= round(($stats['kills']/$stats['time_played']), 2) ?>
            	<?php else: ?>
            		0
            	<?php endif; ?>
			</li>
		</ul>
		<ul class="row">
			<li class="p_heading">Kills per Game</li>
			<li class="p_stats">
				<?php if ($stats['maps']):?>
	            	<?= round(($stats['kills']/$stats['maps']), 2) ?>
	            <?php else :?>
	            	0
	            <?php endif; ?>
			</li>
		</ul>
		<ul class="row">
			<li class="p_heading">Deaths per Minute</li>
			<li class="p_stats">
				<?php if ($stats['time_played']):?>
	            	<?= round(($stats['deaths']/$stats['time_played']), 2) ?>
	            <?php else :?>
	            	0
	            <?php endif; ?>
			</li>
		</ul>
		<ul class="row">
			<li class="p_heading">Deaths per Game</li>
			<li class="p_stats">
				<?php if ($stats['maps']):?>
	            	<?= round(($stats['deaths']/$stats['maps']), 2) ?>
	            <?php else :?>
	            	0
	            <?php endif; ?>
			</li>
		</ul>
	</div>
	<span class="fill"></span>
</div>
<div class="table">
	<h2>Weapons Usage</h2>
	<div class="content">
		<ul class="heading">
			<li class="pwu_name">Name</li>
			<li class="pwu_kills">Kills</li>
			<li class="pwu_accuracy">Accuracy (%)</li>
		</ul>
		<?php $name = array ('Desert Eagles', 'HK MP5', 'Ak-74', 'Steyr AUG', 'Spas-12', 'Ruger 77',
							'M79', 'Barrett M82A1', 'FN Minimi', 'XM214 Minigun', 'USSOCOM',
							'Combat Knife', 'Chainsaw', 'LAW', 'Grenade');
		  		$exclude = array ('Spas-12', 'XM214 Minigun', 'USSOCOM', 'Combat Knife', 'Chainsaw', 'LAW',
		  					'Grenade'); ?>
		<?php foreach ($name as $item): ?>
			<ul class="row">
				<li class="pwu_name">
					<a href="<?=site_url(array('stats','weapon',url_title($item,'underscore')))?>">
	        			<?=$item?>
	        		</a>
				</li>
				<li class="pwu_kills"><?= $stats[$item] ?></li>
				<li class="pwu_accuracy">
					<?php if (!in_array($item, $exclude)): ?>
						<?= $stats['acc'][$item]*100 ?>
					<?php else: ?>
						---
					<?php endif; ?>
				</li>
			</ul>
		<?php endforeach; ?>
		<ul class="row"><li class="srvr_status">"---": Accuracy for this weapon is not supported.</li></ul>
	</div>
	<span class="fill"></span>
</div>